<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <!-- 引入样式 -->
    <!--    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">-->
    <link rel="stylesheet" href="../css/index.css">
    <script src="../js/axios.min.js" type="text/javascript"></script>
    <script src="../js/vue.js" type="text/javascript"></script>
    <script src="../js/index.js" type="text/javascript"></script>
    <!--    <script src="https://unpkg.com/element-ui/lib/index.js"></script>-->
    <title>平台登录界面</title>

</head>
<body>
<div id="app">
    <el-row style="margin-top: 100px;">
        <el-col :span="8" :offset="11">
            <div style="font-size: larger;margin-bottom: 100px">蜗牛瑜伽管理中心</div>
        </el-col>
        <el-col :span="8" :offset="8">
            <el-form ref="form" :model="loginForm" label-width="80px">
                <el-form-item label="账号">
                    <el-input v-model="loginForm.username" placeholder="请输入登录账号"></el-input>
                </el-form-item>
                <el-form-item label="密码">
                    <el-input v-model="loginForm.password" show-password placeholder="请输入密码"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="onSubmit">立即登录</el-button>
                </el-form-item>
            </el-form>
        </el-col>
    </el-row>
</div>
<script>
    new Vue({
        el: "#app",
        data() {
            return {
                loginForm: {
                    username: '',
                    password: ''
                },

            }
        },
        methods: {
            onSubmit() {
                axios.post("/manager/login", this.loginForm).then(resp => {
                    if (resp.status===resp.data.code) {
                        console.log(resp.data.data)

                        this.$message({
                            type: 'success',
                            message: '登录成功，即将跳转'
                        });
                        setTimeout(() => {
                            location.href='managerHome.html'
                        }, 1000)
                    }else{
                        this.$message({
                            type: 'warning',
                            message: '账号或密码错误 请重新输入'
                        });
                    }
                })
            },
        }
    })
</script>
</body>
</html>
